package com.yang.config;

import com.yang.vo.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice("com.yang")
public class GlobalExceptionHandlerConfig {

    @ExceptionHandler(value = RuntimeException.class)
    public ResponseResult handler(RuntimeException exception){
        log.error("发生异常:{}",exception.getMessage());
        return ResponseResult.fail(exception.getMessage());
    }
}
